package imotech.ejb.dao;

import imotech.ejb.model.Imovel;
import imotech.ejb.model.Venda;

import java.util.List;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 * Session Bean implementation class VendaDAOBean
 */
@Stateless
@LocalBean
public class VendaDAOBean implements VendaDAO {

	
	@PersistenceContext(unitName="imotech-ejb")
	private EntityManager em;
	
    /**
     * Default constructor. 
     */
    public VendaDAOBean() {
        // TODO Auto-generated constructor stub
    }

	@Override
	public void cadastrar(Venda venda) {
		em.persist(venda);
		
	}

	@Override
	public List<Venda> todos() {
		return em.createNamedQuery("findTodasVendas", Venda.class).getResultList();
	}

	@Override
	public Venda recuperar(int id) {
		return em.find(Venda.class, id);
	}

	@Override
	public List<Venda> buscar(Venda venda) {
		// TODO Auto-generated method stub
		return null;
	}
    
    
    

}
